next up previous
Next: 4.3 Clip Validation Up: 4 Virtualizing SGI Graphics Previous: 4.1 Making Current to

4.2 Context Switching

Access to the graphics pipe is mediated using virtual memory techniques. The graphics pipe is physically mapped to only one process at a time. Other processes using the graphics pipe will have invalid virtual memory mappings for their pages corresponding to the pipe. If a process without valid mappings accesses a pipe address, a page fault is generated. The kernel graphics driver handles this page fault. If the graphics pipe pages can be physically mapped immediately (there are reasons access to the pipe might temporarily be denied that are discussed later), the kernel will save the graphics context of the current process and mark that process's graphics pipe pages invalid. Then the kernel restores the graphics hardware context for the faulting process and validates that process's memory mapping for the pipe.

The context switching sequence is transparent to the processes involved. If a single process is using the pipe, the pipe does not need to be context switched. Graphics pipe context switching only occurs when there is contention for the pipe. Preemptive scheduling by the kernel ensures graphics processes get a fair allocation of time to access the graphics pipe. On multi-processor machines, the scheduler needs special modifications to prevent two simultaneously scheduled graphics processes from continually stealing the graphics pipe from each other.



mjk@sgi.com